package com.day18.BufferStream;

import java.io.*;

public class BufferStreamDemo {
    public static void main(String[] args) throws IOException {
        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("myByteStream\\fos.txt"));
        bos.write("hello".getBytes());
        bos.write("world".getBytes());
        bos.close();
        BufferedInputStream bis=new BufferedInputStream(new FileInputStream("myByteStream\\fos.txt"));
        byte[] bys=new byte[1024];
        int len;
        while((len=bis.read(bys))!=-1){
            System.out.print(new String(bys,0,len));
        }
        bis.close();
    }
}
